const path=require("path")
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
    mode:"development", //开发环境
    entry:{
        'page1':"./src/index.js",
        'page2':"./src/index2.js"
    }, //开始
    output:{
        filename:"[name]-bundle.js", //打包文件名
        path:path.join(__dirname,"./dist")
    },
    devServer:{
        port:"4000",
        progress:true, //进度条
        compress:true, //Gzip压缩
        contentBase:"./dist"//静态资源目录
    },
    plugins:[
        new HtmlWebpackPlugin({
            filename:"budle1.html",
            template:path.join(__dirname,"./src/index.html"),
            chunks:['page1']
        }),
        new HtmlWebpackPlugin({
            filename:"budle2.html",
            template:path.join(__dirname,"./src/index1.html"),
            chunks:['page2']
        })
    ]
}